<?xml version="1.0" encoding="ISO-8859-1" ?>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="../../context.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Company Data Setup</title>
<%@include file="../common_Admin_imports.jsp"%>
<%@include file="../common_loding_imports.jsp"%>
<script type="text/javascript">
	jQuery(document)
			.ready(
					function() {

						//generate new file browser on link click event
						var image_count = 0;
						jQuery("#add_subsector_filed")
								.on(
										"click",
										function(e) {
											e.preventDefault();

											($('#subSectorSection tbody>tr:last')
													.clone(true))
													.insertAfter('#subSectorSection tbody>tr:last');
											addRemoveHandlers();

										});
						addRemoveHandlers();

					});
	function addRemoveHandlers() {
		jQuery('.remove_sector')
				.on(
						"click",
						function(e) {
							if ($(this).parent().parent() != $('#subSectorSection tbody>tr:first')) {
								$(this).parent().parent().remove();
							}
						});
	}
</script>
</head>
<body>
	<div class="main_wrapper">
		<div class="header_wrapper">
			<div class="container-fluid">
				<div class="header_inner_wrapper clearfix">
					<div class="row-fluid">
						<div class="header_left span4">Company Data Setup</div>
						<jsp:include page="../common_link.jsp" />
					</div>
				</div>
				<div class="content_wrapper">
					<div class="container-fluid">
						<div class="row-fluid">
							<div class="input_box_wrapper">
								<div class="input_box_wrapper_text_aery">
									<div class="span6">
										<form:form method="POST" commandName="company"
											action="${pageContext.request.contextPath}/admin/company/add/process.html"
											class="form-horizontal">
											<div>${message}</div>
											<div class="control-group">
												<label class="control-label" for="inputEmail">Sector
													:</label>
												<div class="controls">
													<form:select itemValue="id" itemLabel="name"
														path="sector.id" items="${sectorsMap}">
													</form:select>
												</div>
											</div>
											<div class="control-group">
												<label class="control-label" for="inputEmail">Name :</label>
												<div class="controls">
													<form:input path="name" />
												</div>
												<div class="controls">
													<form:errors path="name" cssClass="error"></form:errors>
												</div>
											</div>
											<div class="control-group">
												<label class="control-label" for="inputEmail">Code :</label>
												<div class="controls">
													<form:input path="code" />
												</div>
												<div class="controls">
													<form:errors path="code" cssClass="error"></form:errors>
												</div>
											</div>
											<div class="control-group">
												<form:checkbox path="largeCap" itemLabel="id"
													itemValue="name" value="1" />
												<label class="control-label" for="inputEmail">Large
													cap</label>
											</div>
											<div class="control-group">
												<form:checkbox path="asi" itemLabel="id" itemValue="name"
													value="1" />
												<label class="control-label" for="inputEmail">ASI</label>
											</div>
											<div class="control-group">
												<form:checkbox path="snp" itemLabel="id" itemValue="name"
													value="1" />
												<label class="control-label" for="inputEmail">S&P</label>
											</div>
											<div class="control-group">
												<form:checkbox path="status" itemLabel="id" itemValue="name"
													value="1" />
												<label class="control-label" for="inputEmail">Status</label>
											</div>
											<div>
												<table width="100%" id="subSectorSection">
													<tbody class="subSector_body">
														<tr>
															<td>Sub sector</td>
															<td><select name="subSectorId">
																	<option value="0">-- Any --</option>
																	<c:forEach items="${subSectorsMap}" var="subSector">
																		<option value="${subSector.id}">${subSector.name}</option>
																	</c:forEach>
															</select></td>
															<td><a href="javascript:void(0);"
																class="remove_sector">remove sector</a></td>
														</tr>
														<tr>
															<td>Sub sector</td>
															<td><select name="subSectorId">
																	<option value="0">-- Any --</option>
																	<c:forEach items="${subSectorsMap}" var="subSector">
																		<option value="${subSector.id}">${subSector.name}</option>
																	</c:forEach>
															</select></td>
															<td><a href="javascript:void(0);"
																class="remove_sector">remove sector</a></td>
														</tr>
													</tbody>
												</table>
											</div>
											<div>
												<a id="add_subsector_filed" href="">Add sub sector</a>
											</div>

											<input class="btn btn-inverse save" type="submit"
												value="Save" />
										</form:form>
										<b class="file_name"> Upload a file:</b>
										<form:form class="form-horizontal" method="POST"
											modelAttribute="uploadFile" enctype="multipart/form-data"
											action="${pageContext.request.contextPath}/admin/company/add/file_process.html">
											<div>Please select a file to upload :</div>
											<div>
												<input type="file" name="file" /><input
													class="btn btn-inverse save" id="btnSubmitAll"
													type="submit" value="upload" />
											</div>
										</form:form>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<%@include file="../components/loading.jsp"%>
</body>
</html>
